package sandbox.j2se;

import com.googlecode.gentyref.TypeToken;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

public class Types {

    public static void test() {
        double d1 = 3.14;
        Number n1 = d1;
        Collection<Long> ids = new LinkedList<Long>();
        System.out.println("Collection<Long>: " + isLongCollection(Collection.class, ids));
        typeClass();
    }

    private static boolean isLongCollection(Class<?> tClass, Object o) {
        Type type = new TypeToken<Collection<String>>() {
        }.getType();
//        return GenericTypeReflector.isSuperType(type, Collection.class);

        Collection<String> strs = new LinkedList<String>();
        Collection<Long> ids = new LinkedList<Long>();
//        return strs.getClass().isAssignableFrom(ids.getClass());
        System.out.println("strs: " + strs.getClass().getName());
        System.out.println("ids: " + ids.getClass().getName());
        return (strs instanceof List);
    }

    private static void typeClass() {
        Collection<Long> ids = new LinkedList<Long>();
        ids.add(16L);
        ids.add(64L);
        for(Long id: ids) {
            System.out.println("id: " + id.getClass().getName());
        }
    }
}
